package top.jimc.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import top.jimc.spring.helloworld.HelloWorld;
import top.jimc.spring.helloworld.HelloWorldService;

/**
 * @author Jimc.
 * @since 2018/9/27.
 */
public class HelloProgram {

    public static void main(String[] args) {
        // 通过读取beans.xml 文件来创建一个应用程序上下文对象
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");

        HelloWorldService helloWorldService = (HelloWorldService) context.getBean("helloWorldService");

        HelloWorld helloWorld = helloWorldService.getHelloWorld();

        helloWorld.sayHello();
    }
}
